package com.shuaiche.yeguan.model;


import android.text.TextUtils;

import java.io.Serializable;

/**
 * 服务端返回的公共参数
 * @param <T>
 */
public class BaseResponseModel<T> implements Serializable{
    protected String msg;           // 透出给前端的描述（是否需要展示由前端根据实际情况决定
    protected String code;          // 0：成功 如果异常则返回负数
    protected String statusText;    // 状态码描述，对状态码的描述，技术描述，便于排查问题

    protected T data;               // 结果数据 接口需要返回的数据

    protected boolean success;
    protected boolean failed;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getStatusText() {
        if (TextUtils.isEmpty(msg)) {
            return statusText;
        } else  {
            return msg;
        }
    }

    public void setStatusText(String statusText) {
        this.statusText = statusText;
    }


    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public boolean isFailed() {
        return failed;
    }

    public void setFailed(boolean failed) {
        this.failed = failed;
    }
}
